home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11005 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: iz.maus.de!Torsten_Landschoff
  2. From: Torsten_Landschoff@iz.maus.de (Torsten Landschoff)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Memory leak in Borland C++ Tutorial?
  5. Message-ID: <199603110026.a35682@iz.maus.de>
  6. Date: Sun, 10 Mar 96 22:26:00 GMT
  7. References: <4htq3a$lon@status.gen.nz>
  8. X-Gate: MausGate/News 1.25/ac3
  9. MIME-Version: 1.0
  10. Content-Type: text/plain; charset=ISO-8859-1
  11. Content-Transfer-Encoding: 8bit
  12.  
  13. Hi David!
  14.  
  15. DT>I have recently purchased Borland C++ 4.51, and am working my way
  16. DT>through the ObjectWindows Tutorial book.  However, I am very puzzled,
  17. DT>as in many places, the code shown looks like it will cause memory
  18. DT>leaks.
  19.  
  20. It seems to do that but it doesn't. For example:
  21.  
  22. DT>if ( new TFileSaveDialog( this, "FileData()->Execute() == IDOK ) )
  23. DT>SaveFile();
  24.  
  25. The constructor of TFileSaveDialog registers the new dialog at the first
  26. parameter given - the this object. If this is freed the dialog is freed to.
  27.  
  28. DT>SetMainWindow( new TFrameWindow( 0, "Sample ObjectWindows Program" ) )
  29.  
  30. This only sets a global variable which is cleaned up automatically on exit.
  31.  
  32. cu
  33.     Torsten
  34.